package team.stride.tabs.home;

import team.stride.R;
import team.stride.tabs.TabGroupActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;

public class ChooseExerciseActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.choose_exercise_layout);

		final Button startTrackBtn = (Button) findViewById(R.id.start_track_btn);
		final Button warmUpBtn = (Button) findViewById(R.id.warm_up_btn);

		OnTouchListener startTrackBtnListener = new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_UP) {
					Intent intent = new Intent(getParent(),
							RunningActivity.class);
					TabGroupActivity parentActivity = (TabGroupActivity) getParent();
					parentActivity
							.startChildActivity("RunningActivity", intent);
					return true;
				}
				return false;
			}
		};

		OnTouchListener warmUpBtnListener = new OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_UP) {
					Intent intent = new Intent(getParent(),
							WarmUpActivity.class);
					TabGroupActivity parentActivity = (TabGroupActivity) getParent();
					parentActivity.startChildActivity("WarmUpActivity", intent);
					return true;
				}
				return false;
			}
		};

		startTrackBtn.setOnTouchListener(startTrackBtnListener);
		warmUpBtn.setOnTouchListener(warmUpBtnListener);
	}
}
